package se.plingapp.backingbeans;

import java.util.List;
import javax.ejb.EJB;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.RequestScoped;
import se.plingapp.enterprisebeans.UserFacade;
import se.plingapp.entitybeans.User;

/**
 *
 * @author Jens Ljungblad
 */
@ManagedBean
@RequestScoped
public class SearchBean {

    @EJB
    private UserFacade userFacade;

    private List<User> resultList;

    private String query;

    public List<User> getResultList() {
        return this.resultList;
    }

    public String getQuery() {
        return this.query;
    }

    public void setQuery(String query) {
        this.query = query;
    }

    public String search() {
        this.resultList = userFacade.find(query);
        return "/user/search.xhtml";
    }
}